package org.activequant.data.util.series;

import java.util.List;

import org.activequant.core.domainmodel.SeriesSpecification;
import org.activequant.core.domainmodel.data.Candle;
import org.activequant.core.domainmodel.data.CandleSeries;
import org.activequant.data.preparation.IChain;
import org.activequant.data.retrieval.ICandleSeriesSource;
import org.activequant.data.retrieval.ISeriesDataSource;

/**
 * Series source which acts as proxy holding multiple series sources and applying
 * data preparation/transformation filters.<br/>
 * FilterCandleSeriesSource extends FilterSeriesSource&lt;Candle, CandleSeries&gt; implements ICandleSeriesSource.<br/>
 * Holds the following inherited variables:
 * <ul>
 * <li>clazz(Class&lt;Candle&gt;)</li>
 * <li>map(List&lt;Entry&gt;)</li>
 * <li>chain(IChain)</li>
 * <li>data(CandleSeries[])</li>
 * </ul>
 * <p>
 * <b>History:</b><br>
 *  - [29.02.2008] Created (Erik Nijkamp)<br>
 *
 *  @author Erik Nijkamp
 */
public class FilterCandleSeriesSource extends FilterSeriesSource<Candle,CandleSeries> implements ICandleSeriesSource {
	/**
	 * constructs a FilterCandleSeriesSource (extends FilterSeriesSource&lt;Candle, CandleSeries&gt; implements ICandleSeriesSource) whose inherited clazz(Class&lt;Candle&gt;) 
	 * is set to <strong>Candle.class</strong>
	 */
	public FilterCandleSeriesSource() {
		super(Candle.class);
	}

	/**
	 * constructs a FilterCandleSeriesSource (extends FilterSeriesSource&lt;Candle, CandleSeries&gt; implements ICandleSeriesSource) using the given chain(IChain) to set its inherited chain(IChain).<br/>
	 * Set its inherited clazz(Class&lt;Candle&gt;) to <strong>Candle.class</strong>.<br/>
	 * The given seriesSpecifications(SeriesSpecification[]) and dataSources(ISeriesDataSource&lt;CandleSeries&gt;[]) must have the same length and are being used to
	 * create Entry elements and fill the inherited map(List&lt;Entry&gt;) with them.
	 * @param seriesSpecifications
	 * @param dataSources
	 * @param chain
	 */
	public FilterCandleSeriesSource(SeriesSpecification[] seriesSpecifications, 
			ISeriesDataSource<CandleSeries>[] dataSources,
			IChain chain) {
		super(Candle.class, seriesSpecifications, dataSources, chain);
	}
	/**
	 * returns a CandleSeries[] array from the given list(List&lt;CandleSeries&gt;)
	 */
	@Override
	protected CandleSeries[] toArray(List<CandleSeries> list) {
		return list.toArray(new CandleSeries[] {});
	}

}
